/**
 * Desenvolvido pela Fábrica de Software do CESUPA.
 * Todos os direitos reservados.
 */
package br.cesupa.fabsoft.nomedoprojeto.system.application.beans;

import br.cesupa.fabsoft.nomedoprojeto.system.application.facades.ApplicationFacade;
import br.cesupa.fabsoft.nomedoprojeto.system.infra.view.Message;
import br.cesupa.fabsoft.nomedoprojeto.system.infra.view.MessageType;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Backs the log action.
 *
 * @author Breno Leite
 */
public class LoginBean {

    private String email;
    private String password;

    public LoginBean() {
    }

    public String teste() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException ex) {
            Logger.getLogger(LoginBean.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    /**
     * Try to authenticate the current user in the system.
     * 
     * @return a string based navigation stimulus for the controller
     */
    public String enterSystem() {
        Message message = ApplicationFacade.getViewFacade().createMessage(
                "AuthenticationFail", MessageType.PERMISSION_DENIED);
        ApplicationFacade.getViewFacade().manageApplicationStatus().
                displayStatusMessage(message);

        ApplicationFacade.getViewFacade().manageFacesMessages().
                displayErrorMessage("login-form:email-field","HiThere").translated();
        return null;
    }

    /**
     * @return the email used in the login
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to be used in the login
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the password used in the login
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to be used in the login
     */
    public void setPassword(String password) {
        this.password = password;
    }
}
